//
//  BindingPhoneViewController.m
//  CYWFrame
//
//  Created by Macx on 2017/9/29.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "BindingPhoneViewController.h"

#import "LookingPassViewController.h"

@interface BindingPhoneViewController ()

@end

@implementation BindingPhoneViewController {
    UILabel     *_phoneL;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self createUI];
    
}

- (void)createUI {
    
    self.navigationItem.title = @"手机绑定";
    self.view.backgroundColor = UISeparatedColorRGB;
    
    CGSize size = [LZCTools textSizeWithText:@"xx" font:kUHSystemFontWithSize(14)];
    
    _phoneL = [[UILabel alloc] initWithFrame:CGRectMake(20, SW(8), SCREEN_WIDTH-40, size.height)];
    [self.view addSubview:_phoneL];
    _phoneL.text = [NSString stringWithFormat:@"当前绑定的手机号:%@", self.phone];
    _phoneL.textColor = kBlackColor;
    _phoneL.font = kUHSystemFontWithSize(14);
    
    UIButton *completeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:completeBtn];
    [completeBtn setTitle:@"重新绑定" forState:UIControlStateNormal];
    [completeBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
    CGFloat btnHeight = [LZCTools textSizeWithText:@"字数" font:kUHSystemFontWithSize(14)].height+SW(20);
    completeBtn.frame = CGRectMake(20, _phoneL.y+_phoneL.height+20, SCREEN_WIDTH-40, btnHeight);
    completeBtn.backgroundColor = UIMainColorRGB;
    completeBtn.layer.cornerRadius = 5;
    completeBtn.layer.masksToBounds = YES;
    [completeBtn addTarget:self action:@selector(completeClick:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)completeClick:(UIButton *)sender {
    LookingPassViewController *lookVC = [[LookingPassViewController alloc] init];
    [lookVC returnPhone:^(NSString *p) {
        _phoneL.text = [NSString stringWithFormat:@"当前绑定的手机号:%@", p];
    }];
    lookVC.type = @"binding";
    [self.navigationController pushViewController:lookVC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
